<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>聊天室</title>
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/init.css">
    <script type="text/javascript" src="js/jquery-1.12.3.min.js"></script>
</head>
<body>

<script type="text/javascript">
    //https://www.baidu.com:80/
    var ws = new WebSocket("ws://localhost/ws");

    ws.onopen = function () {
        console.log("连接成功")
    }
    ws.onclose = function () {
        console.log("连接关闭")
    }
    ws.onerror = function () {
        console.log("发生错误")
    }
    ws.onmessage= function (event) {
        console.log(event.data);
    }

</script>
</body>
</html>
